/**
 * 
 */
package com.java.test.system.mapper;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import com.java.test.system.dto.MenuInfo;

/**
 * @author Administrator
 *
 */
@Component
public class MenuInfoMapper {

	@Autowired
	private JdbcTemplate jdbcTemplate;

	public List<MenuInfo> selectMenueList(int parentid) {

		String sql = "select * from system_menu where parent_id=?";

		List<MenuInfo> list = jdbcTemplate.query(sql, new MenuInfo(), parentid);

		return list;
	}

	public List<MenuInfo> selectrolemenueListbyrole(String sqlitem) {

		String sql = "select * from system_menu where id in(" + sqlitem + ")";

		List<MenuInfo> list = jdbcTemplate.query(sql, new MenuInfo());

		return list;

	}
	
	
	public MenuInfo selectmenueInfobyid(int id) {

		String sql = "select * from system_menu where id =?";

		MenuInfo info = jdbcTemplate.queryForObject(sql, new MenuInfo(),id);

		return info;
	}


}
